package 杨佳佳.第三章作业;

import java.util.Scanner;

//5、打印菱形，用户输入菱形边长，用*打印出空心菱形。
public class L {
        public static void main(String[] args) {
            System.out.println("请输入行数");
            Scanner sc = new Scanner(System.in);
            if (sc.hasNextInt()) {
                for (int a = 1; a <= 10; a++) {
                    for (int i = 1; i <= 10 - a; i++) {
                        System.out.print(" ");
                    }
                    for (int j = 1; j <= a; j++) {
                        if (j == 1 || j == a) {
                            System.out.print(" *");
                        } else {
                            System.out.print("  ");
                        }
                    }
                    System.out.println("");
                }
                for (int a = 1; a <= 10; a++) {
                    for (int i = 1; i <= a; i++) {
                        System.out.print(" ");
                    }
                    for (int j = 1; j <= 10 - a; j++) {
                        if (j == 1 || j == (10 - a)) {
                            System.out.print(" *");
                        } else {
                            System.out.print("  ");
                        }
                    }
                    System.out.println("");
                }}}}

